Applied Template Metaprogramming in SIunits

نویسنده

  • Walter E. Brown
چکیده

While scientific programmers typically make heavy use of a programming language’s native numeric data types, such practice has been a common source of errors: it obscures the diverse intentions (e.g., distances, masses, energies, momenta, etc.) that any such purely numeric value could represent. Limitations in programming language expressiveness and compiler technology have historically made it difficult to address commensuration in a programming context. However, SIUNITS provides, in C++, a convenient means of computing with numeric values that have attached units. SIUNITS applies compile-time type checking, thus avoiding run-time overhead. Via heavy use of template metaprogramming, SIUNITS provides data types corresponding to all base and derived dimensions specified by le Système international d’Unités (SI), the recognized international standard for describing measurable quantities and their units. Thus, for example, an object resulting from the product of two LENGTH objects is automatically of type AREA. As an important additional feature, SIUNITS permits arbitrary combinations of several provided measurement views, and even allows knowledgeable users to construct their own views.

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

EasyGenetic: A Template Metaprogramming Framework for Genetic Master-Slave Algorithms

In this work we present EasyGenetic, a genetic solver based on template metaprogramming, that enables the user to configure the solver via templates. The framework allows to combine flexibility with efficiency. The framework is designed to be applied to problems for which a master-slave solution strategy can be defined. In the realm of combinatorial optimization, such problems can be those for ...

متن کامل

Metaprogramming Applied to Numerical Problems

Metaprogramming is a programming technique where a computer program is written that writes or manipulates another program (or itself) that then solves a given task. This approach has several advantages over classical programming. Firstly, it leads to more efficient programming because the process of generating code is automated as you basically write code that writes code. Secondly, it might al...

متن کامل

Domain-Specific Language Integration with C++ Template Metaprogramming

Domain specific language integration has to provide the right balance between the expressive power of the DSL and the implementation and maintenance cost of the applied integration techniques. External solutions may perform poorly as they depend on third party tools which should be implemented, tested and then maintained during the whole lifetime of the project. Ideally a self-contained solutio...

متن کامل

Generative Programming and Components:

This paper investigates on the possible advantages of applying generative programming in a component based development process: if a component oriented approach is applied, then generative programming can be used to automatically compose and assemble components. In part one of this paper, I present the application of Generative Programming from an engineering point of view, using a simple but c...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2001